<?php

class ProjectWidget extends Portlet
{
    // {{{ init
    public function init()
    {
        $this->title = Yii::t('site','Project');
        if(
            is_null(Yii::app()->user->getState('SelectedProjectId'))
            or ($this->controller->id=='project' and $this->controller->action->id=='view')
        )
            $this->visible = false;
        parent::init();
    } // }}} 
    // {{{ renderContent
    protected function renderContent()
    {
        $model = Project::model()->findByPk(Yii::app()->user->getState('SelectedProjectId'));
	$this->render('projectWidget',array('model'=>$model));
    } // }}} 
}
